package com.ynhenc.pta.routeRank.impl;

import com.ynhenc.comm.ArrayListEx;
import com.ynhenc.pta.routeRank.*; 
import java.util.*;

public class VertexSetList extends ArrayListEx<VertexSet> {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7353673356272962439L; 
	
	public static void  swapVertexSet( VertexSet a , VertexSet b ) {
		Vertex as = a.getStart();
		Vertex ae = a.getEnd();
		Vertex bs = b.getStart();
		Vertex be = b.getEnd(); 
		
		if( ae.equals( bs ) ) {
			// do nothing !!!! 
		} else if( as.equals(bs) ) {	
			VertexSetList.reverse( a ); 
		} else if( as.equals( be ) ) {
			VertexSetList.reverse( a );
			VertexSetList.reverse( b ); 
		} else if( be.equals( ae ) ){
			VertexSetList.reverse( b ); 
		}  
	}
	
	private static void reverse( VertexSet a ) {
		Collections.reverse( a );
	}

}
